package leecode

func minimumPossibleSum(n int, target int) int {
	ans := make([]int64, 0, n)
	hashMap := make(map[int64]bool)

	for i := 1; len(ans) != n; i++ {
		if hashMap[int64(i)] {
			continue
		}
		hashMap[int64(target-i)] = true
		ans = append(ans, int64(i))
	}

	var result int64
	for i := 0; i < len(ans); i++ {
		result += ans[i]
		result %= int64(1e9 + 7) // 取模操作
	}

	return int(result)
}
